package com.bawei.mvvmdemo.viewmodel;

import com.bawei.mvvmdemo.entity.BannerEntity;
import com.bawei.mvvmdemo.entity.BaseResponseEntity;
import com.bawei.mvvmdemo.entity.GoodsEntity;
import com.bawei.mvvmdemo.entity.TypeEntity;
import com.bawei.mvvmdemo.repository.GoodsRepository;

import java.util.List;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;

/**
 * @Author : yaotianxue
 * @Time : On 2023/9/12 16:43
 * @Description : GoodsViewModel 访问仓库获得数据
 */
public class GoodsViewModel extends ViewModel {
    private GoodsRepository mGoodsRepository = new GoodsRepository();

    //轮播图
    public LiveData<BaseResponseEntity<BannerEntity>> banner(int type, int page, int pageSize){
        return mGoodsRepository.banner(type,page,pageSize);
    }
    //商品分类
    public LiveData<BaseResponseEntity<List<TypeEntity>>> type(int type){
        return mGoodsRepository.type(type);
    }

    //商品信息
    public LiveData<BaseResponseEntity<GoodsEntity>> goods(int id, int page, int size){
        return mGoodsRepository.goods(id,page,size);
    }
}
